package cn.longg.controller;

import cn.longg.entity.Result;
import cn.longg.entity.User;
import cn.longg.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("main/sidenav")
public class SideNavController {

    @RequestMapping("/getLoginUser")
    public Result getLoginUser(HttpServletRequest request){
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute("loginUser");
        return new Result(true,"查询成功",user);
    }



    @RequestMapping("toPersonal")
    public ModelAndView toPersonal(){
        return new ModelAndView("user_look");
    }
}
